package FinalTest10;

import java.awt.*;
import java.util.ArrayList;

public class StudentTest {
    public static void main(String[] args) {
        ArrayList<Student> arrayList = new ArrayList<>();
        Student student = new Student();
        arrayList.add(new Student(1,"张三"));
        arrayList.add(new Student(2,"李四"));
        arrayList.add(new Student(3,"王五"));
//修改前
        for (int i = 0; i < arrayList.size(); i++) {
            System.out.println(arrayList.get(i));
        }
        for (int i = 0; i < arrayList.size(); i++) {
            if (arrayList.get(i).getName().equals("张三")){
                arrayList.get(i).setName("张三丰");
                System.out.println(arrayList);

            }

        }


        for (int i = 0; i < arrayList.size(); i++) {
            if (arrayList.get(i).getName().equals("王五")){
                arrayList.remove(i);
                System.out.println(arrayList);
            }
        }


    }



//                for(int i=0;i<list.size();i++){Student student=list.get(i)}
//        if(student.getName().equals("李四"))集合删除的方法 {list.remove(student);}s out(list)
//        student.getName().equals


//        int index=-1
//        for(Student student:list){
//        index=list.indexof(student) list
}


